//
//  TagForClient.m
//  one_mile_01
//
//  Created by 王雅蓉 on 15/9/17.
//  Copyright (c) 2015年 王雅蓉. All rights reserved.
//

#import "TagForClient.h"

@implementation TagForClient

+ (instancetype) shareTagDataHandle
{
    static TagForClient *tag;
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        tag = [[TagForClient alloc] init];
        tag.isTeacher = NO;
        tag.isAlert = NO;
    });
    
    return tag;
}

-(void)antiBindAccount:(NSString *)useAccount
{
    if (useAccount.length > 0) {
        //用户按下按钮&&输入了准备绑定的帐户名称
        [CloudPushSDK unbindAccount:useAccount withCallback:^(BOOL status) {
            if (status) {
                NSLog(@"==================> 解绑账号成功");
                
                // 切回主线程，防止crash
                dispatch_async(dispatch_get_main_queue(), ^{
                    NSLog(@"解绑账号成功");
                });
                
                NSUserDefaults *userDefaultes = [NSUserDefaults standardUserDefaults];
                [userDefaultes setObject:nil forKey:@"bindAccount"];
                [userDefaultes synchronize];
                
            } else {
                NSLog(@"==================> 解绑账号失败");
            }
        }];
        
    } else {
        NSLog(@"=-=-=-=-=--=-=-=> useAccount不能为空");
    }
}

@end
